<?php

namespace app\admin\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class AirportTest extends CommonTest
{

    //再命令窗口中执行“php think interface-AirportTest”
    protected function configure()
    {
        $this->setName('interface-AirportTest')->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        //Route::any('admin/airport/create', 'admin/airport/toAddAirport');                                                       // 添加机场
//        $data = Tools::curl($this->url . "admin/airport/create", json_encode(["token" => "$this->token", "name" => "xxx", "price" => "5", "placards" => true]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

        //Route::any('admin/airport/getPageList', 'admin/airport/getAirportList');                                                // 机场列表，分页功能
//        $data = Tools::curl($this->url . "admin/airport/getPageList", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

        //Route::any('admin/airport/getDetailsById', 'admin/airport/getAirportDetail');                                           // 机场详细信息
//        $data = Tools::curl($this->url . "admin/airport/getDetailsById", json_encode(["token" => "$this->token", "id" => 1]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

        //Route::any('admin/airport/getAll', 'admin/airport/getAirportAll');                                                      // 获取所有的机场
        $data = Tools::curl($this->url . "admin/airport/getAll", json_encode(["token" => "$this->token"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

    }
}
